x86/boot: Detect the firmware SMT setting correctly on Intel hardware
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 5 Apr 2019 12:26:30 +0000 (13:26 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 14 May 2019 14:37:39 +0000 (15:37 +0100)
commit0d8e6f72980cc17d23389483daa27f5c492c34c3
treed56d0f28ee0cbe6491aa61eccfb15fba996397ff
parent9be661341da5d260c1b8fd969e4ba5c53d076e54
x86/boot: Detect the firmware SMT setting correctly on Intel hardware

While boot_cpu_data.x86_num_siblings is an accurate value to use on AMD
hardware, it isn't on Intel when the user has disabled Hyperthreading in the
firmware.  As a result, a user which has chosen to disable HT still gets
nagged on L1TF-vulnerable hardware when they haven't chosen an explicit
smt=<bool> setting.

Make use of the largely-undocumented MSR_INTEL_CORE_THREAD_COUNT which in
practice exists since Nehalem, when booting on real hardware.  Fall back to
using the ACPI table APIC IDs.

While adjusting this logic, fix a latent bug in amd_get_topology().  The
thread count field in CPUID.0x8000001e.ebx is documented as 8 bits wide,
rather than 2 bits wide.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
(cherry picked from commit b12fec4a125950240573ea32f65c61fb9afa74c3)
xen/arch/x86/cpu/amd.c
xen/arch/x86/spec_ctrl.c